package dfa;

import fa.FARule;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.List;
import java.util.Set;

import static org.junit.jupiter.api.Assertions.*;

/**
 * @author haoly
 * @title DFADesignTest
 * @date 2025/4/16 12:33
 * @description DFADesignTest
 */
public class DFADesignTest {
    @Test
    void testAccepts() {
        List<FARule<Integer>> rules = Arrays.asList(
                new FARule<>(1, 'a', 2),
                new FARule<>(1, 'b', 1),
                new FARule<>(2, 'a', 2),
                new FARule<>(2, 'b', 3),
                new FARule<>(3, 'a', 3),
                new FARule<>(3, 'b', 3)
        );
        DFARulebook<Integer> rulebook = new DFARulebook<>(rules);

        DFADesign<Integer> dfaDesign = new DFADesign<>(1, Set.of(3), rulebook);
        assertFalse(dfaDesign.accepts("a"));
        assertFalse(dfaDesign.accepts("baa"));
        assertTrue(dfaDesign.accepts("baba"));

    }
}
